#衡量Q矩阵是否收敛
import numpy as np
def measureQ(preQ,nextQ):
    difference = nextQ - preQ
    difference = difference * difference
    result = np.sum(difference)
    result = float('%.4f' % result)
    return  result

pre = np.array([[3,2],[1,2]])
next = np.array([[1,1],[1,1]])
print(measureQ(pre,next))